#ifndef _FPGA_DATA_BUILD_H_
#define _FPGA_DATA_BUILD_H_
/** @defgroup 构建默认测试参数
 * @{
 *
 * 所谓的自动配置并不是真的自动配置，而是因为采样时钟测量距离、测量脉宽之间
 * 关系密切，所以启动一个测试量程测试前先用对应的 AUTO_BUILD_xxx 构造结构体
 * struct fpga_test_param 模板，然后再根据需要做细微修改，如激光器(laser)、运放
 * (amp)、APD电压(apd)等
 *
 * @see 各量程脉冲列表
 */
#define AUTO_BUILD_300M(ptr)                                       \
    {                                                              \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr; \
	p->laser_ch               = 1310;                          \
	p->pulse                  = 20 /*TP_PULSE_1KM_40_NS*/;     \
	p->sample_freq            = 0;                             \
	p->adopt_pt               = 32000;                         \
	p->add_cnt                = 10000;                         \
	p->amp                    = TP_AMP_L1(0x01);               \
	p->apd_vol                = TP_APD_39V;                    \
	p->power                  = OTDR_LASER_PW_LV1;             \
	p->isrun                  = 1;                             \
    }  ///< 默认 300M 配置配置参数，填充 fpga_test_param
#define AUTO_BUILD_1KM(ptr)                                        \
    {                                                              \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr; \
	p->laser_ch               = 1310;                          \
	p->pulse                  = 20 /*TP_PULSE_5KM_160_NS*/;    \
	p->sample_freq            = 0;                             \
	p->adopt_pt               = 32000;                         \
	p->add_cnt                = 10000;                         \
	p->amp                    = TP_AMP_L1(0x01);               \
	p->apd_vol                = TP_APD_39V;                    \
	p->power                  = OTDR_LASER_PW_LV2;             \
	p->isrun                  = 1;                             \
    }  ///< 默认 1KM 配置配置参数，填充 fpga_test_param
#define AUTO_BUILD_5KM(ptr)                                        \
    {                                                              \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr; \
	p->laser_ch               = 1310;                          \
	p->pulse                  = 80 /*TP_PULSE_5KM_160_NS*/;    \
	p->sample_freq            = 0;                             \
	p->adopt_pt               = 32000;                         \
	p->add_cnt                = 10000;                         \
	p->amp                    = TP_AMP_L1(0x01);               \
	p->apd_vol                = TP_APD_39V;                    \
	p->power                  = OTDR_LASER_PW_LV2;             \
	p->isrun                  = 1;                             \
    }  ///< 默认 5KM 配置配置参数，填充 fpga_test_param
#define AUTO_BUILD_10KM(ptr)                                       \
    {                                                              \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr; \
	p->laser_ch               = 1310;                          \
	p->pulse                  = 80 /*TP_PULSE_10KM_320_NS*/;   \
	p->sample_freq            = 0;                             \
	p->adopt_pt               = 32000;                         \
	p->add_cnt                = 10000;                         \
	p->amp                    = TP_AMP_L1(0x01);               \
	p->apd_vol                = TP_APD_39V;                    \
	p->power                  = OTDR_LASER_PW_LV2;             \
	p->isrun                  = 1;                             \
    }  ///< 默认 10KM 配置配置参数，填充 fpga_test_param
#define AUTO_BUILD_60KM(ptr)                                       \
    {                                                              \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr; \
	p->laser_ch               = 1310;                          \
	p->pulse                  = 80 /*TP_PULSE_60KM_1280_NS*/;  \
	p->sample_freq            = 0;                             \
	p->adopt_pt               = 32000;                         \
	p->add_cnt                = 10000;                         \
	p->amp                    = TP_AMP_L1(0x01);               \
	p->apd_vol                = TP_APD_39V;                    \
	p->power                  = OTDR_LASER_PW_LV3;             \
	p->isrun                  = 1;                             \
    }  ///< 默认 60KM 配置配置参数，填充 fpga_test_param
#define AUTO_BUILD_100KM(ptr)                                       \
    {                                                               \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr;  \
	p->laser_ch               = 1310;                           \
	p->pulse                  = 80 /*TP_PULSE_100KM_10240_NS*/; \
	p->sample_freq            = 0;                              \
	p->adopt_pt               = 32000;                          \
	p->add_cnt                = 10000;                          \
	p->amp                    = TP_AMP_L1(0x01);                \
	p->apd_vol                = TP_APD_39V;                     \
	p->power                  = OTDR_LASER_PW_LV3;              \
	p->isrun                  = 1;                              \
    }  ///< 默认 100KM 配置配置参数，填充 fpga_test_param
#define AUTO_BUILD_180KM(ptr)                                       \
    {                                                               \
	struct fpga_test_param *p = (struct fpga_test_param *)ptr;  \
	p->laser_ch               = 1310;                           \
	p->pulse                  = 80 /*TP_PULSE_180KM_20480_NS*/; \
	p->sample_freq            = 0;                              \
	p->adopt_pt               = 32000;                          \
	p->add_cnt                = 10000;                          \
	p->amp                    = TP_AMP_L1(0x01);                \
	p->apd_vol                = TP_APD_39V;                     \
	p->power                  = OTDR_LASER_PW_LV4;              \
	p->isrun                  = 1;                              \
    }  ///< 默认 200KM 配置配置参数，填充 fpga_test_param


#endif